'use strict';
const db = uniCloud.database()

exports.main = async (event, context) => {
    const { id, data } = event
    const collection = db.collection('todo')

    try {
        await collection.doc(id).update(data)
        return {
            code: 0,
            message: '更新成功'
        }
    } catch (error) {
        return {
            code: -1,
            message: '更新失败'
        }
    }
} 